﻿using Core.RabbitMQ.Consumer;
using Core.WebApi.Consume.Dto;
using Newtonsoft.Json;

namespace Core.WebApi.Consume
{
    public class TestConsumer : IConsumer<TestMessage>
    {
        private readonly ILogger<TestMessage> _logger;

        public TestConsumer(ILogger<TestMessage> logger)
        {
            _logger = logger;
        }
        public Task ReceiveMessageAsync(string messageId, TestMessage message, CancellationToken cancellationToken = default)
        {
            _logger.LogInformation($"消费消息：ID:{messageId},Body：" + JsonConvert.SerializeObject(message));
            return Task.CompletedTask;
        }
    }
}
